﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VIP.Extension;

/// <summary>
/// Mono生命周期事件
/// 一些不继承Mono的类如果想在Mono生命周期做一些事，可以往这里添加
/// </summary>
public class VIPMonoEvent : VIPMonoSingleton<VIPMonoEvent>
{
    public event Action UPDATE;
    public event Action FIXEDUPDATE;
    public event Action ONGUI;
    public event Action LATEUPDATE;

    private void Update()
    {
        if (UPDATE.IsNotNull())
        {
            UPDATE.Invoke();
        }
    }

    private void FixedUpdate()
    {
        if (FIXEDUPDATE.IsNotNull())
        {
            FIXEDUPDATE.Invoke();
        }
    }

    private void OnGUI()
    {
        if (ONGUI.IsNotNull())
        {
            ONGUI.Invoke();
        }
    }

    private void LateUpdate()
    {
        if (LATEUPDATE.IsNotNull())
        {
            LATEUPDATE.Invoke();
        }
    }
}